package com.mxp.influx.client.config;

import com.mxp.influx.client.entity.api.ApiController;
import com.mxp.influx.client.entity.api.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常拦截
 * @author maoxp
 * @date 2024-12-24 17:11
 */
@Slf4j
@RestControllerAdvice
public class ExceptionAdvice extends ApiController {
    @ExceptionHandler
    public R doBusinessException(Exception ex){
        log.error(ex.getMessage(), ex);
        return error(ex.getMessage());
    }
}
